package com.h1909d.weinfo.model;

import com.h1909d.weinfo.base.BaseModel;
import com.h1909d.weinfo.bean.DailyNewsBean;
import com.h1909d.weinfo.net.HttpUtil;
import com.h1909d.weinfo.net.ResultCallBack;
import com.h1909d.weinfo.net.ResultSubscriber;
import com.h1909d.weinfo.net.RxUtils;

public class DailyNewsModel extends BaseModel {
    public void getLatestNews(final ResultCallBack<DailyNewsBean> callBack){
        HttpUtil.getInstance()
                .getZhihuService()
                .getLatestNews()
                .compose(RxUtils.<DailyNewsBean>rxSchedulerHelper())
                .subscribeWith(new ResultSubscriber<DailyNewsBean>() {
                    @Override
                    public void onNext(DailyNewsBean dailyNewsBean) {
                        callBack.onSuccess(dailyNewsBean);
                    }
                });
    }
}
